Re: Using wildcard for table name ? - Mailing list pgsql-novice

From Daniel Staal
Subject Re: Using wildcard for table name ?
Date
Msg-id 7D9863B019350999829ECE7F@[192.168.1.50]
Whole thread Raw
In response to Using wildcard for table name ?  (Francisco Leovey <fleovey@yahoo.com>)
List pgsql-novice
--As of July 26, 2013 11:21:44 AM -0700, Francisco Leovey is alleged to
have said:

> I have a database in Postgres 9 with 75 tables, all have the exact same
> definition except for the name of the table.
> Each one contains data for people who are doctors (table name = doctors),
> nurses (table name = nurses) etc. etc.
> How can I do a select to find a given person's name (a single field)
> without mentioniing all 75 table names ? I do not need to know fron which
> table it came, just need to know if it exists.
>
> Is there a "select * from * where *.name ='Joe Blow';" kind of syntax ?
>
> I could join all tables into one to do the search but we want to keep
> data separated due to volume.
> Thanks

--As for the rest, it is mine.

This sounds like a database design problem.  May I suggest looking at using
one partitioned table instead?

<http://www.postgresql.org/docs/9.2/interactive/ddl-partitioning.html>

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


pgsql-novice by date:

Previous
From: Francisco Leovey
Date:
Subject: Using wildcard for table name ?
Next
From: David Johnston
Date:
Subject: Re: Using wildcard for table name ?